home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14931 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.sprintlink.net!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Destructors in Inheritance
  5. Date: Tue, 02 Apr 1996 14:55:54 -0500
  6. Organization: Datalytics, Inc
  7. Message-ID: <3161864A.5592@datalytics.com>
  8. References: <Pine.SOL.3.91.960402132752.10414A-100000@vu-vlsi.ee.vill.edu>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Senthilvel Rangaswamy wrote:
  16. > I have a base class which has a destructor function in it.
  17. > I derive a class from this base class. If I don't write
  18. > any destructor for the derived class, will the destructor
  19. > of the base class will be called when the derived class
  20. > objects goes out of scope.
  21.  
  22. Yes it will.  Note, however, that when a class is a base class, 
  23. it is wise to code it with a virtual destructor.  This ensures 
  24. that the derived class destructors are called correctly even 
  25. through a pointer or reference to the base class.
  26.  
  27. -- 
  28. Robert Stewart        | My opinions are usually my own.
  29. Datalytics, Inc.    | stew@datalytics.com
  30.